<template>
	<view class="container">
		<view v-if="relation_id&&isEnable != '否'" class="list-cell b-b" @click="navTo('/pages/member/zhifubao')"
			hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">提现账号设置</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view class="list-cell b-b" style="margin-top: 2upx" @click="navTo('/pages/public/bind')"
			hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">换绑手机号</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view style="margin-top: 1px" class="list-cell b-b" @click="navTo1('/pages/member/xieyi')"
			hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">用户协议</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view style="margin-top: 1px" class="list-cell b-b" @click="navTo1('/pages/member/mimi')"
			hover-class="cell-hover" :hover-stay-time="50">
			<text class="cell-tit">隐私政策</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<!-- <view style="margin-top: 1px" class="list-cell b-b" @click="navTo1('/package/pages/index/bangzhu')" hover-class="cell-hover"
			:hover-stay-time="50">
			<text class="cell-tit">帮助中心</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<view style="margin-top: 1px" class="list-cell b-b" @click="navTo1('/pages/feedback')" hover-class="cell-hover"
			:hover-stay-time="50">
			<text class="cell-tit">意见反馈</text>
			<text class="cell-more yticon icon-you"></text>
		</view> -->
		<view style="margin-top: 1px" class="list-cell b-b" @click="navTo1('/package/pages/index/xitong?name=关于我们&id=106')" hover-class="cell-hover"
			:hover-stay-time="50">
			<text class="cell-tit">关于我们</text>
			<text class="cell-more yticon icon-you"></text>
		</view>
		<button v-if="isShow" class="confirm-btn" @click="toLogout">退出登录</button>
	</view>
</template>

<script>
	import {
		mapMutations
	} from 'vuex';

	export default {
		data() {
			return {
				guanyu: '',
				isShow: false,
				isWXShow: false,
				version: '',
				isEnable: '否',
				relation_id: '',
			};
		},
		onShow() {
			this.guanyu = this.$queue.getData('GYWN');
			let a = this.$queue.getData('isEnable');
			if (a) {
				this.isEnable = a;
			}
			let that = this;
			let token = this.$queue.getData("token");
			let relation_id = this.$queue.getData("relation_id");
			if (relation_id) {
				this.relation_id = relation_id;
			}

			// #ifdef H5
			let target = navigator.userAgent.toLowerCase();
			let isWeixin = (/micromessenger/.test(target)) ? true : false;
			this.payList = [];
			if (isWeixin) {
				this.isWXShow = false;
			} else {
				this.isWXShow = true;
			}
			// #endif
			// #ifdef APP-PLUS
			this.isWXShow = true;
			// #endif

			if (token) {
				this.isShow = true;
			}

		},
		methods: {
			navTo1(url) {
				uni.navigateTo({
					url: url
				});
			},
			about(url) {
				uni.showModal({
					showCancel: false,
					title: '关于我们',
					content: this.guanyu,
					success: e => {
						if (e.confirm) {}
					}
				});
			},
			//退出登录
			toLogout() {
				let that = this;
				uni.showModal({
					title: '退出提醒',
					content: '确定要退出登录么',
					success: e => {
						if (e.confirm) {
							that.$queue.remove('token');
							that.$queue.remove('userId');
							that.$queue.remove('mobile');
							that.$queue.remove('openid');
							that.$queue.remove('grade');
							that.$queue.remove('nickName');
							that.$queue.remove('isInvitation');
							that.$queue.remove('image_url');
							that.$queue.remove('relation_id');
							that.$queue.remove('relation');
							that.isShow = false;
							setTimeout(() => {
								uni.switchTab({
									url: '/pages/member/user'
								});
							}, 200);
						}
					}
				});
			},
			navTo(url) {
				let token = this.$queue.getData("token");
				if (token) {
					uni.navigateTo({
						url: url
					});
				} else {
					uni.navigateTo({
						url: '/pages/member/register'
					});
				}
			}
		}
	}
</script>

<style lang='scss'>
	page {
		background: $page-color-base;
	}

	.confirm-btn {
		width: 300px;
		height: 42px;
		line-height: 42px;
		border-radius: 30px;
		margin-top: 60upx;
		background: -moz-linear-gradient(left, #f15b6c, #e10a07 100%);
		background: -webkit-gradient(linear, left top, left right, color-stop(0, #f15b6c), color-stop(100%, #e10a07));
		background: -webkit-linear-gradient(left, #f15b6c 0, #e10a07 100%);
		background: -o-linear-gradient(left, #f15b6c 0, #e10a07 100%);
		background: -ms-linear-gradient(left, #f15b6c 0, #e10a07 100%);
		background: linear-gradient(to left, #f15b6c 0, #e10a07 100%);
		color: #fff;
		font-size: $font-lg;

		&:after {
			border-radius: 60px;
		}
	}

	.list-cell {
		display: flex;
		align-items: baseline;
		padding: 20upx $page-row-spacing;
		line-height: 60upx;
		position: relative;
		background: #fff;
		justify-content: center;

		&.log-out-btn {
			margin-top: 40upx;

			.cell-tit {
				color: $uni-color-primary;
				text-align: center;
				margin-right: 0;
			}
		}

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 32upx;
		}

		&.m-t {
			margin-top: 18upx;
		}

		.cell-more {
			align-self: baseline;
			font-size: $font-lg;
			color: $font-color-light;
			margin-left: 12upx;
		}

		.cell-tit {
			flex: 1;
			font-size: $font-base + 2upx;
			color: $font-color-dark;
			margin-right: 12upx;
		}

		switch {
			transform: translateX(8px) scale(.84);
		}
	}
</style>
